<?php
namespace App\Http\Middleware;

use Closure,Session,Redirect;
use App\Module\EntManageuser;

class AdminCookies
{

    public function handle($request, Closure $next)
    {

        $data['title']          = '网站后台管理中心';
        $data['keywords']       = '网站后台管理中心';
        $data['description']    = '网站后台管理中心';

        $AName  = Session::get('AName');
        $AKey   = Session::get('AKey');

        if(empty($AName) || empty ($AKey))
        {
            $url = "http://".$request->server->get('SERVER_NAME')."/admin_system";
            $content = "<script>window.parent.location.href='{$url}';</script>";
            exit($content);
            return redirect('admin_system');
        }
        return $next($request);
    }
}